package com.hdax.dmw.utils;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
public class Result<T> implements Serializable {

    public static final String DEFAULT_SUCCESS_CODE = "0000";
    public static final String DEFAULT_FAIL_CODE = "9999";

    private String success;
    private String errorCode;// "0000" 成功响应
    private String msg;
    private T data;

    public Result(String errorCode, String msg) {
        this.errorCode = errorCode;
        this.msg = msg;
    }

    public Result( String msg) {
        this.errorCode = DEFAULT_FAIL_CODE;
        this.msg = msg;
    }

    public Result(){}

    public Result(String msg, T data) {
        this.msg = msg;
        this.data = data;
    }

    public Result(T data) {
        this.msg = "";
        this.errorCode = DEFAULT_SUCCESS_CODE;
        this.data = data;
    }
}
